#!/usr/bin/env ruby
# ------------------------------------------------------
# File          : rbenv-cn.rb
# Authors       : Aoran Zeng <ccmywish@qq.com>
# Created on    : <2022-03-23>
# Last modified : <2023-09-06>
#
# rbenv-cn:
#
#   install `rbenv` and `rbenv-cn` plugin quickly
# for Chinese users.
# ------------------------------------------------------

def install
  exec <<EOF
bash -c "$(curl -fsSL https://gitee.com/RubyMetric/rbenv-cn/raw/main/tools/install.sh)"
EOF
end

def uninstall
  exec <<EOF
  bash -c "$(curl -fsSL https://gitee.com/RubyMetric/rbenv-cn/raw/main/tools/uninstall.sh)"
EOF
end


def help
  puts <<-EOH
rbenv-cn:

    该Gem仅用于帮助您快速安装/卸载`rbenv-cn`
    https://gitee.com/RubyMetric/rbenv-cn

usage:

    rbenv-cn install   => 安装
    rbenv-cn uninstall => 卸载

EOH
end


if ARGV.empty?
  help
else
  if ARGV[0] == "install"
    install
  elsif ARGV[0] == "uninstall"
    uninstall
  else
    help
  end
end
